package com.ts.api.exp;

import com.ts.api.common.constant.BizEnum;

/**
 * 业务异常
 */
public class BizException extends RuntimeException {

    /** 业务异常枚举 */
    private BizEnum bizEnum;

    public BizException() {
        super();
    }

    public BizException(BizEnum bizEnum) {
        super(bizEnum.getMsg());
        this.bizEnum = bizEnum;
    }

    public BizEnum getBizEnum() {
        return bizEnum;
    }

    public void setBizEnum(BizEnum bizEnum) {
        this.bizEnum = bizEnum;
    }


    /**
     * 快速抛出
     * @param bizEnum
     */
    public static void fastFail(BizEnum bizEnum) {
        throw new BizException(bizEnum);
    }
}
